import { nilAxiosInstance, defAxiosInstance } from ".."

// 公开组
export const ping = () => {
    return nilAxiosInstance({
        url: "/usercenter/nil/ping",
        method: "get"
    })
}
export const loginPwd = (data:{email:string, pwd:string}) => {
    return nilAxiosInstance({
        url: "/usercenter/nil/login-pwd",
        method: "post",
        data
    })
}
export const loginCaptcha = (data:{email:string, captcha:string, operate:string}) => {
    data.operate = "登录"
    return nilAxiosInstance({
        url: "/usercenter/nil/login-captcha",
        method: "post",
        data
    })
}
export const register = (data:{email:string, nickname:string, pwd:string, captcha: string, operate: string}) => {
    data.operate = "注册"
    return nilAxiosInstance({
        url: "/usercenter/nil/register",
        method: "post",
        data
    })
}
export const forget = (data:{email:string, pwd:string, captcha:string, operate:string}) => {
    data.operate = "找回"
    return nilAxiosInstance({
        url: "/usercenter/nil/forget",
        method: "post",
        data
    })
}

// 鉴权组
export const userInfo = () => {
    return defAxiosInstance({
        url: "/usercenter/def/info",
        method: "get"
    })
}
export const userEdit = (data: any) => {
    return defAxiosInstance({
        url: "/usercenter/def/edit",
        method: "post",
        data
    })
}
export const userLogout = () => {
    return defAxiosInstance({
        url: "/usercenter/def/logout",
        method: "post"
    })
}
export const editPswd = (data: any) => {
    data.operate = "修改密码"
    return defAxiosInstance({
        url: "/usercenter/def/edit-pwd",
        method: "post",
        data
    })
}
export const upload = (data: any) => {
    return defAxiosInstance({
        url: "/usercenter/def/upload",
        method: "put",
        headers: {
            'content-type': 'multipart/form-data'
        },
        data
    })
}
